package com.tmt.im.jpa.entity;

import com.tmt.data.jpa.entity.TmtBaseAuthority;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.springframework.security.core.GrantedAuthority;

import java.io.Serial;
import java.util.List;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/7/18 13:20
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "im_authority")
@Tag(name = "im_authority", description = "权限表")
public class IMAuthority extends TmtBaseAuthority implements GrantedAuthority {

    @Serial
    private static final long serialVersionUID = 2719789241456744055L;

    @OneToMany(mappedBy = "authority", cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY)
    private List<IMRoleAuthority> roleAuthorities;

}
